import type { PermissionItem, AddPermission } from '@/types/permission'
import { request } from '@/utils/request'

// 获取权限点列表
export const getPersmissionListApi = () => {
  return request<PermissionItem[]>('/sys/permission')
}

// 删除权限点
export const delPermissionApi = (id: string) => {
  return request(`/sys/permission/${id}`, 'DELETE')
}

// 新增权限点
export const addPermissionApi = (data: AddPermission) => {
  return request('/sys/permission', 'POST', data)
}

// 获取权限点详情
export const getPermissionDetailApi = (id: string) => {
  return request<AddPermission>(`/sys/permission/${id}`)
}

// 修改权限点
export const updatePermissionApi = (data: AddPermission) => {
  return request(`/sys/permission/${data.id}`, 'PUT', data)
}
